/*eslint-disable block-scoped-var, id-length, no-control-regex, no-magic-numbers, no-prototype-builtins, no-redeclare, no-shadow, no-var, sort-vars*/
"use strict";

var $protobuf = require("protobufjs/minimal");

// Common aliases
var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util;

// Exported root namespace
var $root = $protobuf.roots["default"] || ($protobuf.roots["default"] = {});

$root.CS_LOGIN = (function() {

    /**
     * Properties of a CS_LOGIN.
     * @exports ICS_LOGIN
     * @interface ICS_LOGIN
     * @property {string|null} [token] CS_LOGIN token
     * @property {string|null} [extra] CS_LOGIN extra
     */

    /**
     * Constructs a new CS_LOGIN.
     * @exports CS_LOGIN
     * @classdesc Represents a CS_LOGIN.
     * @implements ICS_LOGIN
     * @constructor
     * @param {ICS_LOGIN=} [p] Properties to set
     */
    function CS_LOGIN(p) {
        if (p)
            for (var ks = Object.keys(p), i = 0; i < ks.length; ++i)
                if (p[ks[i]] != null)
                    this[ks[i]] = p[ks[i]];
    }

    /**
     * CS_LOGIN token.
     * @member {string} token
     * @memberof CS_LOGIN
     * @instance
     */
    CS_LOGIN.prototype.token = "";

    /**
     * CS_LOGIN extra.
     * @member {string|null|undefined} extra
     * @memberof CS_LOGIN
     * @instance
     */
    CS_LOGIN.prototype.extra = null;

    // OneOf field names bound to virtual getters and setters
    var $oneOfFields;

    // Virtual OneOf for proto3 optional field
    Object.defineProperty(CS_LOGIN.prototype, "_extra", {
        get: $util.oneOfGetter($oneOfFields = ["extra"]),
        set: $util.oneOfSetter($oneOfFields)
    });

    /**
     * Creates a new CS_LOGIN instance using the specified properties.
     * @function create
     * @memberof CS_LOGIN
     * @static
     * @param {ICS_LOGIN=} [properties] Properties to set
     * @returns {CS_LOGIN} CS_LOGIN instance
     */
    CS_LOGIN.create = function create(properties) {
        return new CS_LOGIN(properties);
    };

    /**
     * Encodes the specified CS_LOGIN message. Does not implicitly {@link CS_LOGIN.verify|verify} messages.
     * @function encode
     * @memberof CS_LOGIN
     * @static
     * @param {ICS_LOGIN} m CS_LOGIN message or plain object to encode
     * @param {$protobuf.Writer} [w] Writer to encode to
     * @returns {$protobuf.Writer} Writer
     */
    CS_LOGIN.encode = function encode(m, w) {
        if (!w)
            w = $Writer.create();
        if (m.token != null && Object.hasOwnProperty.call(m, "token"))
            w.uint32(10).string(m.token);
        if (m.extra != null && Object.hasOwnProperty.call(m, "extra"))
            w.uint32(18).string(m.extra);
        return w;
    };

    /**
     * Decodes a CS_LOGIN message from the specified reader or buffer.
     * @function decode
     * @memberof CS_LOGIN
     * @static
     * @param {$protobuf.Reader|Uint8Array} r Reader or buffer to decode from
     * @param {number} [l] Message length if known beforehand
     * @returns {CS_LOGIN} CS_LOGIN
     * @throws {Error} If the payload is not a reader or valid buffer
     * @throws {$protobuf.util.ProtocolError} If required fields are missing
     */
    CS_LOGIN.decode = function decode(r, l) {
        if (!(r instanceof $Reader))
            r = $Reader.create(r);
        var c = l === undefined ? r.len : r.pos + l, m = new $root.CS_LOGIN();
        while (r.pos < c) {
            var t = r.uint32();
            switch (t >>> 3) {
            case 1: {
                    m.token = r.string();
                    break;
                }
            case 2: {
                    m.extra = r.string();
                    break;
                }
            default:
                r.skipType(t & 7);
                break;
            }
        }
        return m;
    };

    /**
     * Gets the default type url for CS_LOGIN
     * @function getTypeUrl
     * @memberof CS_LOGIN
     * @static
     * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
     * @returns {string} The default type url
     */
    CS_LOGIN.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
        if (typeUrlPrefix === undefined) {
            typeUrlPrefix = "type.googleapis.com";
        }
        return typeUrlPrefix + "/CS_LOGIN";
    };

    return CS_LOGIN;
})();

$root.PLAYER_DATA = (function() {

    /**
     * Properties of a PLAYER_DATA.
     * @exports IPLAYER_DATA
     * @interface IPLAYER_DATA
     * @property {string|null} [id] PLAYER_DATA id
     * @property {string|null} [name] PLAYER_DATA name
     */

    /**
     * Constructs a new PLAYER_DATA.
     * @exports PLAYER_DATA
     * @classdesc Represents a PLAYER_DATA.
     * @implements IPLAYER_DATA
     * @constructor
     * @param {IPLAYER_DATA=} [p] Properties to set
     */
    function PLAYER_DATA(p) {
        if (p)
            for (var ks = Object.keys(p), i = 0; i < ks.length; ++i)
                if (p[ks[i]] != null)
                    this[ks[i]] = p[ks[i]];
    }

    /**
     * PLAYER_DATA id.
     * @member {string} id
     * @memberof PLAYER_DATA
     * @instance
     */
    PLAYER_DATA.prototype.id = "";

    /**
     * PLAYER_DATA name.
     * @member {string} name
     * @memberof PLAYER_DATA
     * @instance
     */
    PLAYER_DATA.prototype.name = "";

    /**
     * Creates a new PLAYER_DATA instance using the specified properties.
     * @function create
     * @memberof PLAYER_DATA
     * @static
     * @param {IPLAYER_DATA=} [properties] Properties to set
     * @returns {PLAYER_DATA} PLAYER_DATA instance
     */
    PLAYER_DATA.create = function create(properties) {
        return new PLAYER_DATA(properties);
    };

    /**
     * Encodes the specified PLAYER_DATA message. Does not implicitly {@link PLAYER_DATA.verify|verify} messages.
     * @function encode
     * @memberof PLAYER_DATA
     * @static
     * @param {IPLAYER_DATA} m PLAYER_DATA message or plain object to encode
     * @param {$protobuf.Writer} [w] Writer to encode to
     * @returns {$protobuf.Writer} Writer
     */
    PLAYER_DATA.encode = function encode(m, w) {
        if (!w)
            w = $Writer.create();
        if (m.id != null && Object.hasOwnProperty.call(m, "id"))
            w.uint32(10).string(m.id);
        if (m.name != null && Object.hasOwnProperty.call(m, "name"))
            w.uint32(18).string(m.name);
        return w;
    };

    /**
     * Decodes a PLAYER_DATA message from the specified reader or buffer.
     * @function decode
     * @memberof PLAYER_DATA
     * @static
     * @param {$protobuf.Reader|Uint8Array} r Reader or buffer to decode from
     * @param {number} [l] Message length if known beforehand
     * @returns {PLAYER_DATA} PLAYER_DATA
     * @throws {Error} If the payload is not a reader or valid buffer
     * @throws {$protobuf.util.ProtocolError} If required fields are missing
     */
    PLAYER_DATA.decode = function decode(r, l) {
        if (!(r instanceof $Reader))
            r = $Reader.create(r);
        var c = l === undefined ? r.len : r.pos + l, m = new $root.PLAYER_DATA();
        while (r.pos < c) {
            var t = r.uint32();
            switch (t >>> 3) {
            case 1: {
                    m.id = r.string();
                    break;
                }
            case 2: {
                    m.name = r.string();
                    break;
                }
            default:
                r.skipType(t & 7);
                break;
            }
        }
        return m;
    };

    /**
     * Gets the default type url for PLAYER_DATA
     * @function getTypeUrl
     * @memberof PLAYER_DATA
     * @static
     * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
     * @returns {string} The default type url
     */
    PLAYER_DATA.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
        if (typeUrlPrefix === undefined) {
            typeUrlPrefix = "type.googleapis.com";
        }
        return typeUrlPrefix + "/PLAYER_DATA";
    };

    return PLAYER_DATA;
})();

$root.SC_LOGIN = (function() {

    /**
     * Properties of a SC_LOGIN.
     * @exports ISC_LOGIN
     * @interface ISC_LOGIN
     * @property {number|null} [code] SC_LOGIN code
     * @property {string|null} [msg] SC_LOGIN msg
     * @property {IPLAYER_DATA|null} [player] SC_LOGIN player
     */

    /**
     * Constructs a new SC_LOGIN.
     * @exports SC_LOGIN
     * @classdesc Represents a SC_LOGIN.
     * @implements ISC_LOGIN
     * @constructor
     * @param {ISC_LOGIN=} [p] Properties to set
     */
    function SC_LOGIN(p) {
        if (p)
            for (var ks = Object.keys(p), i = 0; i < ks.length; ++i)
                if (p[ks[i]] != null)
                    this[ks[i]] = p[ks[i]];
    }

    /**
     * SC_LOGIN code.
     * @member {number} code
     * @memberof SC_LOGIN
     * @instance
     */
    SC_LOGIN.prototype.code = 0;

    /**
     * SC_LOGIN msg.
     * @member {string} msg
     * @memberof SC_LOGIN
     * @instance
     */
    SC_LOGIN.prototype.msg = "";

    /**
     * SC_LOGIN player.
     * @member {IPLAYER_DATA|null|undefined} player
     * @memberof SC_LOGIN
     * @instance
     */
    SC_LOGIN.prototype.player = null;

    /**
     * Creates a new SC_LOGIN instance using the specified properties.
     * @function create
     * @memberof SC_LOGIN
     * @static
     * @param {ISC_LOGIN=} [properties] Properties to set
     * @returns {SC_LOGIN} SC_LOGIN instance
     */
    SC_LOGIN.create = function create(properties) {
        return new SC_LOGIN(properties);
    };

    /**
     * Encodes the specified SC_LOGIN message. Does not implicitly {@link SC_LOGIN.verify|verify} messages.
     * @function encode
     * @memberof SC_LOGIN
     * @static
     * @param {ISC_LOGIN} m SC_LOGIN message or plain object to encode
     * @param {$protobuf.Writer} [w] Writer to encode to
     * @returns {$protobuf.Writer} Writer
     */
    SC_LOGIN.encode = function encode(m, w) {
        if (!w)
            w = $Writer.create();
        if (m.code != null && Object.hasOwnProperty.call(m, "code"))
            w.uint32(8).int32(m.code);
        if (m.msg != null && Object.hasOwnProperty.call(m, "msg"))
            w.uint32(18).string(m.msg);
        if (m.player != null && Object.hasOwnProperty.call(m, "player"))
            $root.PLAYER_DATA.encode(m.player, w.uint32(26).fork()).ldelim();
        return w;
    };

    /**
     * Decodes a SC_LOGIN message from the specified reader or buffer.
     * @function decode
     * @memberof SC_LOGIN
     * @static
     * @param {$protobuf.Reader|Uint8Array} r Reader or buffer to decode from
     * @param {number} [l] Message length if known beforehand
     * @returns {SC_LOGIN} SC_LOGIN
     * @throws {Error} If the payload is not a reader or valid buffer
     * @throws {$protobuf.util.ProtocolError} If required fields are missing
     */
    SC_LOGIN.decode = function decode(r, l) {
        if (!(r instanceof $Reader))
            r = $Reader.create(r);
        var c = l === undefined ? r.len : r.pos + l, m = new $root.SC_LOGIN();
        while (r.pos < c) {
            var t = r.uint32();
            switch (t >>> 3) {
            case 1: {
                    m.code = r.int32();
                    break;
                }
            case 2: {
                    m.msg = r.string();
                    break;
                }
            case 3: {
                    m.player = $root.PLAYER_DATA.decode(r, r.uint32());
                    break;
                }
            default:
                r.skipType(t & 7);
                break;
            }
        }
        return m;
    };

    /**
     * Gets the default type url for SC_LOGIN
     * @function getTypeUrl
     * @memberof SC_LOGIN
     * @static
     * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
     * @returns {string} The default type url
     */
    SC_LOGIN.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
        if (typeUrlPrefix === undefined) {
            typeUrlPrefix = "type.googleapis.com";
        }
        return typeUrlPrefix + "/SC_LOGIN";
    };

    return SC_LOGIN;
})();

$root.Msg = (function() {

    /**
     * Properties of a Msg.
     * @exports IMsg
     * @interface IMsg
     * @property {number|null} [id] Msg id
     * @property {Uint8Array|null} [data] Msg data
     */

    /**
     * Constructs a new Msg.
     * @exports Msg
     * @classdesc Represents a Msg.
     * @implements IMsg
     * @constructor
     * @param {IMsg=} [p] Properties to set
     */
    function Msg(p) {
        if (p)
            for (var ks = Object.keys(p), i = 0; i < ks.length; ++i)
                if (p[ks[i]] != null)
                    this[ks[i]] = p[ks[i]];
    }

    /**
     * Msg id.
     * @member {number} id
     * @memberof Msg
     * @instance
     */
    Msg.prototype.id = 0;

    /**
     * Msg data.
     * @member {Uint8Array|null|undefined} data
     * @memberof Msg
     * @instance
     */
    Msg.prototype.data = null;

    // OneOf field names bound to virtual getters and setters
    var $oneOfFields;

    // Virtual OneOf for proto3 optional field
    Object.defineProperty(Msg.prototype, "_data", {
        get: $util.oneOfGetter($oneOfFields = ["data"]),
        set: $util.oneOfSetter($oneOfFields)
    });

    /**
     * Creates a new Msg instance using the specified properties.
     * @function create
     * @memberof Msg
     * @static
     * @param {IMsg=} [properties] Properties to set
     * @returns {Msg} Msg instance
     */
    Msg.create = function create(properties) {
        return new Msg(properties);
    };

    /**
     * Encodes the specified Msg message. Does not implicitly {@link Msg.verify|verify} messages.
     * @function encode
     * @memberof Msg
     * @static
     * @param {IMsg} m Msg message or plain object to encode
     * @param {$protobuf.Writer} [w] Writer to encode to
     * @returns {$protobuf.Writer} Writer
     */
    Msg.encode = function encode(m, w) {
        if (!w)
            w = $Writer.create();
        if (m.id != null && Object.hasOwnProperty.call(m, "id"))
            w.uint32(8).int32(m.id);
        if (m.data != null && Object.hasOwnProperty.call(m, "data"))
            w.uint32(18).bytes(m.data);
        return w;
    };

    /**
     * Decodes a Msg message from the specified reader or buffer.
     * @function decode
     * @memberof Msg
     * @static
     * @param {$protobuf.Reader|Uint8Array} r Reader or buffer to decode from
     * @param {number} [l] Message length if known beforehand
     * @returns {Msg} Msg
     * @throws {Error} If the payload is not a reader or valid buffer
     * @throws {$protobuf.util.ProtocolError} If required fields are missing
     */
    Msg.decode = function decode(r, l) {
        if (!(r instanceof $Reader))
            r = $Reader.create(r);
        var c = l === undefined ? r.len : r.pos + l, m = new $root.Msg();
        while (r.pos < c) {
            var t = r.uint32();
            switch (t >>> 3) {
            case 1: {
                    m.id = r.int32();
                    break;
                }
            case 2: {
                    m.data = r.bytes();
                    break;
                }
            default:
                r.skipType(t & 7);
                break;
            }
        }
        return m;
    };

    /**
     * Gets the default type url for Msg
     * @function getTypeUrl
     * @memberof Msg
     * @static
     * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
     * @returns {string} The default type url
     */
    Msg.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
        if (typeUrlPrefix === undefined) {
            typeUrlPrefix = "type.googleapis.com";
        }
        return typeUrlPrefix + "/Msg";
    };

    return Msg;
})();

$root.ERROR = (function() {

    /**
     * Properties of a ERROR.
     * @exports IERROR
     * @interface IERROR
     * @property {string|null} [msg] ERROR msg
     */

    /**
     * Constructs a new ERROR.
     * @exports ERROR
     * @classdesc Represents a ERROR.
     * @implements IERROR
     * @constructor
     * @param {IERROR=} [p] Properties to set
     */
    function ERROR(p) {
        if (p)
            for (var ks = Object.keys(p), i = 0; i < ks.length; ++i)
                if (p[ks[i]] != null)
                    this[ks[i]] = p[ks[i]];
    }

    /**
     * ERROR msg.
     * @member {string} msg
     * @memberof ERROR
     * @instance
     */
    ERROR.prototype.msg = "";

    /**
     * Creates a new ERROR instance using the specified properties.
     * @function create
     * @memberof ERROR
     * @static
     * @param {IERROR=} [properties] Properties to set
     * @returns {ERROR} ERROR instance
     */
    ERROR.create = function create(properties) {
        return new ERROR(properties);
    };

    /**
     * Encodes the specified ERROR message. Does not implicitly {@link ERROR.verify|verify} messages.
     * @function encode
     * @memberof ERROR
     * @static
     * @param {IERROR} m ERROR message or plain object to encode
     * @param {$protobuf.Writer} [w] Writer to encode to
     * @returns {$protobuf.Writer} Writer
     */
    ERROR.encode = function encode(m, w) {
        if (!w)
            w = $Writer.create();
        if (m.msg != null && Object.hasOwnProperty.call(m, "msg"))
            w.uint32(18).string(m.msg);
        return w;
    };

    /**
     * Decodes a ERROR message from the specified reader or buffer.
     * @function decode
     * @memberof ERROR
     * @static
     * @param {$protobuf.Reader|Uint8Array} r Reader or buffer to decode from
     * @param {number} [l] Message length if known beforehand
     * @returns {ERROR} ERROR
     * @throws {Error} If the payload is not a reader or valid buffer
     * @throws {$protobuf.util.ProtocolError} If required fields are missing
     */
    ERROR.decode = function decode(r, l) {
        if (!(r instanceof $Reader))
            r = $Reader.create(r);
        var c = l === undefined ? r.len : r.pos + l, m = new $root.ERROR();
        while (r.pos < c) {
            var t = r.uint32();
            switch (t >>> 3) {
            case 2: {
                    m.msg = r.string();
                    break;
                }
            default:
                r.skipType(t & 7);
                break;
            }
        }
        return m;
    };

    /**
     * Gets the default type url for ERROR
     * @function getTypeUrl
     * @memberof ERROR
     * @static
     * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
     * @returns {string} The default type url
     */
    ERROR.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
        if (typeUrlPrefix === undefined) {
            typeUrlPrefix = "type.googleapis.com";
        }
        return typeUrlPrefix + "/ERROR";
    };

    return ERROR;
})();

module.exports = $root;
